import Vue from 'vue'
import VueRouter from 'vue-router';

import api from '../http/apis/api.js';


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login/Login.vue')
  },

  //  理赔管理
  {
    path: '/system',
    name: 'System',
    component: () => import('../views/system/system.vue'),
    children: [
      {
        path: 'claimList',
        name: 'ClaimList',
        component: () => import('../components/claim/List.vue')
      },
      {
        path: 'addClaim',
        name: 'AddClaim',
        component: () => import("../components/claim//Add.vue")
      },
      {
        path: 'updateClaim',
        name: 'UpdateClaim',
        component: () => import("../components/claim//Update.vue")
      },
      // {
      //   //客户管理
      //   path: 'customer',
      //   component: () => import('../components/customer/customer.vue'),
      // },
      {
        path: '/system/customer',
        redirect: 'customerList'
      },
      {
        path: 'customerAdd',
        component: () => import('../components/customer/customerAdd.vue'),
      },
      {
        path: 'customerList',
        component: () => import('../components/customer/customerList.vue'),
      },
      {
        //管理员列表
        path: 'adminsList',
        name: 'AdminsList',
        component: () => import('../components/admins/AdminsList.vue')
      },
      {
        //新增管理员
        path: 'addAdmins',
        name: 'AddAdmins',
        component: () => import('../components/admins/AddAdmins.vue')
      },
      {
        //销售人员列表
        path: 'salesPersonList',
        name: 'SalesPersonList',
        component: () => import('../components/salesperson/SalesPersonList.vue')
      },
      {
        //新增销售人员
        path: 'addSalesPerson',
        name: 'AddSalesPerson',
        component: () => import('../components/salesperson/AddSalesPerson.vue')
      },
      {
        //查看xx销售员的客户
        path: 'checkCustomer',
        name: 'CheckCustomer',
        component: () => import('../components/salesperson/CheckCustomer.vue')
      },
      {
        path: "categorylist",
        name: "Categorylist",
        props: true,//允许通过props接收数据
        component: () => import("../components/productcategory/Categorylist.vue"),
        meta: {
          keepAlive: false,
        }
      },
      {
        path: "addcategory",
        name: "Addcategory",
        props: true,//允许通过props接收数据
        component: () => import("../components/productcategory/Addcategory.vue"),

      },
      {
        path: "changecategory",
        name: "Changecategory",
        props: true,//允许通过props接收数据
        component: () => import("../components/productcategory/Changecategory.vue"),

      },

      //  保险产品增删查改
      {
        path: "productlist",
        name: "Productlist",
        props: true,//允许通过props接收数据
        component: () => import("../components/product/Productlist.vue"),
        meta: {
          keepAlive: false,
        }
      },
      {
        path: "addproduct",
        name: "Addproduct",
        props: true,//允许通过props接收数据
        component: () => import("../components/product/Addproduct.vue"),

      },
      {
        path: "changeproduct/:_id",
        name: "Changeproduct",
        props: true,//允许通过props接收数据
        component: () => import("../components/product/Changeproduct.vue"),

      },
      //    //  保险产品增删查改结束

    ]
  }]
  const router = new VueRouter({
        routes,
        mode: 'history'
      })
      
      export default router


